<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>修改密码</title>
    <link rel="shortcut icon" href="favicon.ico">
    <link href="__PUBLIC__/Theme1/css/bootstrap.min.css?v=3.3.6" rel="stylesheet">
    <link href="__PUBLIC__/Theme1/css/font-awesome.min.css?v=4.4.0" rel="stylesheet">
    <link href="__PUBLIC__/Theme1/css/plugins/iCheck/custom.css" rel="stylesheet">
    <link href="__PUBLIC__/Theme1/css/animate.min.css" rel="stylesheet">
    <link href="__PUBLIC__/Theme1/css/style.min.css?v=4.1.0" rel="stylesheet">
    <link href="__PUBLIC__/Theme1/static/plupload/upfiless.css" rel="stylesheet" type="text/css"/>
    <link href="__PUBLIC__/Theme1/lib/webuploader/0.1.5/webuploader.css" rel="stylesheet" type="text/css"/>
    <link href="__PUBLIC__/Theme1/css/plugins/awesome-bootstrap-checkbox/awesome-bootstrap-checkbox.css"
          rel="stylesheet">
   <style>
       .button, .button:visited {
           background: #222 url(overlay.png) repeat-x;
           display: inline-block;
           padding: 5px 10px 6px;
           color: #fff;
           text-decoration: none;
           -moz-border-radius: 6px;
           -webkit-border-radius: 6px;
           -moz-box-shadow: 0 1px 3px rgba(0,0,0,0.6);
           -webkit-box-shadow: 0 1px 3px rgba(0,0,0,0.6);
           text-shadow: 0 -1px 1px rgba(0,0,0,0.25);
           border-bottom: 1px solid rgba(0,0,0,0.25);
           position: relative;
           cursor: pointer
       }
   </style>
</head>
<body class="gray-bg">
<div class="wrapper wrapper-content animated fadeInRight">
    <div class="row">
        <div class="col-sm-12">
            <div class="ibox float-e-margins">
                <div class="ibox-title">
                    <h5><a href="/User/update_password"><input type="button" value="修改登录密码" style="background: #1AB394" class="button"/></a></h5>
                    <h5><a href="/User/update_pwd2"><input type="button" value="修改二级密码" style="background: #1AB394" class="button"/></a></h5>
                    <div class="ibox-tools">
                    </div>
                </div>
                <div class="ibox-content">
                    <form method="post" action="" class="form-horizontal" id="form-admin-add"
                          enctype="multipart/form-data">

                        <div class="form-group">
                            <label class="col-sm-1 control-label">会员编号</label>
                            <div class="col-sm-3">
                                <input type="text" value="<{$userarr.loginname}>" name="txt_loginname"
                                       id="txt_loginname" readonly="readonly" class="form-control"/>
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="col-sm-1 control-label">原始登录密码</label>
                            <div class="col-sm-3">
                                <input type="password" name="pwd1_now" id="pwd1_now"
                                       class="form-control" required="required" onblur="check_pwd1(this.value)" placeholder="请正确输入原登录密码"/>
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="col-sm-1 control-label">新的登录密码</label>
                            <div class="col-sm-3">
                                <input type="password" name="pwd1" id="pwd1"
                                       class="form-control" required="required" pattern=".{6,}" placeholder="长度至少为6位字符   如123456"
                                       onchange="checkPasswords()"/>
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="col-sm-1 control-label">确认登录密码</label>
                            <div class="col-sm-3">
                                <input type="password" name="pwd1_confirm" id="pwd1_confirm"
                                       class="form-control" required="required" placeholder="再次输入密码"
                                       onchange="checkPasswords()"/>
                            </div>
                        </div>


                        <div class="hr-line-dashed"></div>
                        <div class="form-group">
                            <div class="col-sm-4 col-sm-offset-2">
                                <button class="btn btn-primary" type="submit">修改登录密码</button>
                            </div>
                        </div>
                    </form>
                </div>
            </div>
        </div>
    </div>
</div>

<script src="__PUBLIC__/Theme1/js/jquery.min.js?v=2.1.4"></script>
<script src="__PUBLIC__/Theme1/js/bootstrap.min.js?v=3.3.6"></script>
<script src="__PUBLIC__/Theme1/js/content.min.js?v=1.0.0"></script>
<script src="__PUBLIC__/Theme1/js/plugins/iCheck/icheck.min.js"></script>

<script type="text/javascript" src="__PUBLIC__/Theme1/check/js/jquery.validate.min.js"></script>

<script type="text/javascript" src="__PUBLIC__/Theme1/check/js/messages_zh.min.js"></script>

<script type="text/javascript" src="__PUBLIC__/Theme1/check/js/validate-methods.js"></script>
<script type="text/javascript" src="__PUBLIC__/Theme1/lib/webuploader/0.1.5/webuploader.min.js"></script>

<script>
    $(document).ready(function () {
        $('#pwd1_now').focus();
//        $(".i-checks").iCheck({checkboxClass: "icheckbox_square-green", radioClass: "iradio_square-green",});
    });
    function check_pwd1(pwd1){
        $.ajax({
            type:"GET",
            url: "__URL__/check_pwd1",
            data:{pwd1:pwd1},
            dataType:'json',
            success:function (data) {
                if(!data=='1'){
                    $('#pwd1_now').val('').focus().attr('placeholder','请正确输入原登录密码');
                }
            }
        });


    }
    function checkPasswords() {
        var pass1 = document.getElementById("pwd1");
        var pass2 = document.getElementById("pwd1_confirm");

        if (pass1.value != pass2.value) {
//            $('#pwd1').val('');
//            $('#pwd1_confirm').val('');
            pass1.setCustomValidity("两次输入的密码不匹配");
        } else {
            pass1.setCustomValidity("");
        }


    }
</script>

</body>

</html>
